<template>
  <div class="child">
    <h1>Child Window</h1>
    <n-button @click="sendToMain">Send Message to Main</n-button>
    <n-button @click="close">Close</n-button>
  </div>
</template>

<script setup lang="ts">
import useWindowManager from '@/hooks/windowManager';

const { sendWindowMessage, close } = useWindowManager();
// const {close} = windowControls
// 向主窗口发送消息
const sendToMain = () => {
  sendWindowMessage('main', 'child-message', {
    timestamp: Date.now(),
    content: 'Hello from child!'
  });
};
</script>

<style>
.drag-region {
  -webkit-app-region: drag;
  height: 32px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
}
</style>